package org.wattdepot.cli.commands;

import javax.xml.datatype.XMLGregorianCalendar;
import org.wattdepot.util.tstamp.Tstamp;

/**
 * Contains methods which validates timestamps.
 * 
 * @author Jarret Mizo, Shaun Ramento
 * 
 */
public class ValidateDay {
  /**
   * Checks if day inputed is valid.
   * 
   * @param day is the day inputed
   * @return An XMLGregorianCalender timestamp or null if couldn't create timestamp
   */
  public XMLGregorianCalendar validateDay(String day) {
    try {
      return Tstamp.makeTimestamp(day);
    }
    catch (Exception exception) {
      System.out.println("Unable to create timestamp from input.");
      return null;
    }
  }
}
